import { StorageKey } from "@/types/global"

type authRouteParamsType = {
    currentPath: string,
    router: any
}
type authRouteType = ({ currentPath, router }: authRouteParamsType) => void

const whiteList = [
    '\/login',
    '\/error-page\/*',
]
const authRoute: authRouteType = ({ currentPath, router }: authRouteParamsType) => {
    const token = sessionStorage.getItem(StorageKey.TOKEN) || ""
    const isWhite = whiteList.some((item) => {
        return new RegExp(item).test(currentPath)
    })

    // // 未登录
    // if(!isWhite && !token) {
    //     router.push({name: 'login'})
    // } 
}
export default authRoute
